﻿<%@ Page Title="" Language="C#" MasterPageFile="~/PageTemplate.Master" AutoEventWireup="true" CodeBehind="Users.aspx.cs" Inherits="RMS.Pages.Admin.Users" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContent" runat="server">
    
    <!-- Users web form allows admin users to edit / delete users. -->
    <h1>Edit, Remove, or View User Accounts</h1>
    <hr />
    <br />
    <table>
        <tr>
            <td style="vertical-align: middle;">
                <span class="bluetext">Search By: </span> 
            </td>
            <td style="vertical-align: middle;">
                <select id="cbUserSelect" runat="server">
                    <option value="All Users">All Users</option>
                    <option value="Basic Users">Basic Users</option>
                    <option value="Admin Users">Admin Users</option>
                </select>
            </td>
            <td style="vertical-align: middle;">
                &nbsp;&nbsp;
                <asp:Button ID="btnSearch" CssClass="myButton" runat="server" Text="Search" OnClick="btnSearch_Click"/>
            </td>
        </tr>
    </table>
    <hr />
    
    <asp:ListView ID="ListView1" ItemType="RMS.Models.User" SelectMethod="GetUsers"
        DataKeyNames="Us_Id" UpdateMethod="UpdateUser"
        DeleteMethod="DeleteUser" InsertMethod="InsertUser"
        InsertItemPosition="LastItem" EnableViewState="false" runat="server">

        <LayoutTemplate>
             
            <table class="editTable" runat="server" id="itemPlaceholder"> 
                
           </table>

        </LayoutTemplate>

        <ItemTemplate>
            <table class="editUsersTable">
                <tr>
                    <td>First Name:</td>
                    <td><%# Item.Us_FName %></td>
                </tr>
                <tr>
                    <td>Last Name:</td>
                    <td><%# Item.Us_LName %></td>
                </tr>
                <tr>
                    <td>Middle Initial:</td>
                    <td><%# Item.Us_MInt %></td>
                </tr>
                <tr>
                    <td>Email:</td>
                    <td><%# Item.Us_Email %></td>
                </tr>
                <tr>
                    <td>Street Address:</td>
                    <td><%# Item.Us_Address %></td>
                </tr>
                <tr>
                    <td>City:</td>
                    <td><%# Item.Us_City %></td>
                </tr>
                <tr>
                    <td>State:</td>
                    <td><%# Item.Us_State %></td>
                </tr>
                <tr>
                    <td>Zip Code:</td>
                    <td><%# Item.Us_Zip %></td>
                </tr>
                <tr>
                    <td>Phone Number:</td>
                    <td><%# Item.Us_Phone %></td>
                </tr>
                <tr>
                    <td>Is Admin User?</td>
                    <td><%# Item.Us_IsAdmin %></td>
                </tr>
                <tr>
                    <td>Volunteer Selections:</td>
                    <td><%# getVolunteerSubmissions(Item.Us_ID) %></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td> 
                        <asp:Button CssClass="myButton" ID="Button1" CommandName="Edit" Text="Edit" runat="server" />
                        <asp:Button CssClass="myButton" ID="Button2" CommandName="Delete" Text="Remove" OnClientClick="return confirm('Are you sure you want to remove this user?');" runat="server" />
                    </td>
                </tr>
             </table>
            <hr />            
                    
        </ItemTemplate>

        <EditItemTemplate>
            <table class="editUsersTable">
                <tr>
                    <td>First Name:</td>
                    <td>
                        <input class="txtbxcomp lettersOnly" name="Us_FName" value="<%# Item.Us_FName %>" />
                        <input type="hidden" name="Us_Id" value="<%# Item.Us_ID %>" />
                    </td>
                </tr>
                <tr>
                    <td>Last Name:</td>
                    <td><input class="txtbxcomp lettersOnly" name="Us_LName" value="<%# Item.Us_LName %>" /></td>
                </tr>
                <tr>
                    <td>Middle Inital:</td>
                    <td><input class="txtbxcomp lettersOnly" name="Us_LName" value="<%# Item.Us_MInt %>" /></td>
                </tr>
                <tr>
                    <td>Phone Number:</td>
                    <td><input class="txtbxcomp numberssOnly" name="Us_Phone" value="<%# Item.Us_Phone %>" /></td>
                </tr>
                 <tr>
                    <td>Email:</td>
                    <td><input class="txtbxcomp" name="Us_Email" value="<%# Item.Us_Email %>" /></td>
                </tr>
                <tr>
                    <td>Street Address:</td>
                    <td><input class="txtbxcomp" name="Us_Address" value="<%# Item.Us_Address %>" /></td>
                </tr>
                <tr>
                    <td>City:</td>
                    <td><input class="txtbxcomp lettersOnly" name="Us_City" value="<%# Item.Us_City %>" /></td>
                </tr>
                <tr>
                    <td>State:</td>
                    <td><input class="txtbxcomp lettersOnly" name="Us_State" value="<%# Item.Us_State %>" /></td>
                </tr>

                <tr>
                    <td>Zip Code:</td>
                    <td><input class="txtbxcomp numbersOnly" name="Us_Zip" value="<%# Item.Us_Zip %>" /></td>
                </tr>
                <tr>
                    <td>
                        Admin Status:
                    </td>
                    <td>
                        <select class="largetxtbxcomp" name="Us_IsAdmin" >
                            <option selected="selected"><%# Item.Us_IsAdmin %></option>
                            <option value="<%# returnOpposite(Item.Us_IsAdmin) %>"><%# returnOpposite(Item.Us_IsAdmin) %></option>
                        </select>
                    </td>
                </tr>
                 <tr>
                    <td>New Password:</td>
                    <td><input class="txtbxcomp" name="Us_Password" type="password" /></td>
                    
                 </tr>
                
                <tr>
                    <td>&nbsp;</td>
                    <td> 
                        <asp:Button CssClass="myButton" ID="Button3" CommandName="Update" Text="Update" runat="server"/>
                        <asp:Button CssClass="myButton" ID="Button4" CommandName="Cancel" Text="Cancel" runat="server"/>
                    </td>
                </tr>
                   
            </table>
            <hr />           
            
            
        </EditItemTemplate>
             
        <InsertItemTemplate> </InsertItemTemplate>
        
    </asp:ListView>
   
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="SidebarContent" runat="server">
    <span><a href="/pages/UserAccount.aspx">View Admin Account</a></span>
    <span><a href="/admin/retreats">Edit, Remove, or View Retreats</a></span>
    <span><a href="/admin/addretreat">Add Retreats</a></span>
    <span><a href="/admin/reports">Generate Reports</a></span>
    <span><a class="selected" href="/pages/admin/Users.aspx">Edit, Remove, or View Users</a></span>
    <span><a href="/pages/CreateAccount.aspx">Add Users</a></span>
</asp:Content>
